package cn.taobaoke.restful.datasource;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author bjyangzuo
 * @since 2017-05-05 17:45
 */
public class DynamicDataSourceContextHolder {

    public static void setDataSourceType(String dataSourceType) {
        contextHolder.set(dataSourceType);
    }

    public static String getDataSourceType() {
        return contextHolder.get();
    }

    public static void clearDataSourceType() {
        contextHolder.remove();
    }

    public static final Map<String, String> dataSourceMap = new ConcurrentHashMap<>();

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
}
